package com.starlink.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.starlink.common.PageQueryRequest;
import com.starlink.model.domain.MallBooksOrderDetailsDO;
import com.starlink.model.request.MallBooksOrderDetailsRequest;
import com.starlink.model.vo.BookReadingRecordVO;
import com.starlink.model.vo.MallBooksOrderDetailsVO;
import com.starlink.model.vo.mall.MallOrderDetailListVO;
import org.springframework.data.domain.Pageable;

import java.util.List;
import java.util.Map;

/**
 * @author zhanghong
 */
public interface MallOrderDetailsService extends IService<MallBooksOrderDetailsDO> {

    /**
     * 根据主键查询
     * @param id
     * @return
     */
    MallBooksOrderDetailsVO getByKey(long id);
    /**
     * 分页查询，手动分页
     * @param request
     * @return
     */
    PageInfo<MallBooksOrderDetailsVO> pageQuery(MallBooksOrderDetailsRequest request, Pageable pageable);
    /**
     * 列表查询
     * @param request
     * @return
     */
    List<MallBooksOrderDetailsVO> listQuery(MallBooksOrderDetailsRequest request);
    /**
     * 新增
     * @param request
     * @return
     */
    Boolean add(MallBooksOrderDetailsRequest request);
    /**
     * 根据主键更新
     * @param request
     * @return
     */
    Boolean updateByKey(MallBooksOrderDetailsRequest request);
    /**
     * 根据主键删除
     * @param ids
     * @return
     */
    Boolean deleteDOByIds(String ids);

    /**
     * 查询未记录书籍订单
     * @param userId
     * @param pageable
     * @param request
     * @return
     */
    List<BookReadingRecordVO> pageQueryNot(Long userId, Pageable pageable, PageQueryRequest request);

    /**
     * 修改记录状态
     * @param bookId
     * @param orderId
     */
    void updateRecord(Long bookId, Long orderId);

    /**
     * 查询库存数量
     * @param orderId
     * @return
     */
    Map<String, Long> selectQuantity(Long orderId,Integer type);

    /**
     * 根据订单ID查询商品规格ID
     * @param orderId
     * @return
     */
    Long selectBookSpecificationId(Long orderId);

    Long selectRimSpecificationId(Long orderId);

    void deleteBookOrderDetaile(Long orderId);

    MallOrderDetailListVO selectBookOrderDetail(Long orderId);

    MallOrderDetailListVO selectRimOrderDetail(Long orderId);

    void updateIsRefunds(Long orderId);

    /**
     * 根据订单ID删除
     * @param stringIds
     */
    void deletedByOrderIds(String stringIds);
}